using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ServerTools._Caching
{
    /// <summary>
    /// <para>Manage Map Server Cache Tiles</para>
    /// <para>Creates and updates tiles in an existing web tile layer cache. This tool is used to create new tiles, replace missing tiles, overwrite outdated tiles, and delete tiles.</para>
    /// <para>在现有 Web 切片图层缓存中创建和更新切片。此工具用于创建新切片、替换缺失的切片、覆盖过时的切片和删除切片。</para>
    /// </summary>    
    [DisplayName("Manage Map Server Cache Tiles")]
    public class ManageMapServerCacheTiles : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ManageMapServerCacheTiles()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_input_service">
        /// <para>Input Service</para>
        /// <para>The web tile layer or map image layer whose cache tiles you want to update. You can choose it by browsing to the desired service in Portal or you can drag and drop a web tile layer from the Project pane Portal tab to supply this parameter.</para>
        /// <para>要更新其缓存切片的 Web 切片图层或地图图像图层。您可以通过在门户中浏览到所需的服务来选择它，也可以从工程窗格门户选项卡拖放 Web 切片图层以提供此参数。</para>
        /// </param>
        /// <param name="_scales">
        /// <para>Scales</para>
        /// <para><xdoc>
        ///   <para>A list of scale levels at which tiles will be created.</para>
        ///   <para>By default, the scales listed in the tool dialog are between the minimum and maximum cached scales for the service. You cannot change the cache scale range of the service with ArcGIS Pro.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将创建切片的比例级别的列表。</para>
        ///   <para>默认情况下，工具对话框中列出的刻度介于服务的最小和最大缓存刻度之间。您无法使用 ArcGIS Pro 更改服务的缓存比例范围。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_update_mode">
        /// <para>Update Mode</para>
        /// <para><xdoc>
        ///   <para>The mode for updating the cache.</para>
        ///   <bulletList>
        ///     <bullet_item>Recreate Empty Tiles—Only tiles that are empty will be created. Existing tiles will be left unchanged. This option is not available for web tile layers published to ArcGIS Online.</bullet_item><para/>
        ///     <bullet_item>Recreate All Tiles—Existing tiles will be replaced and new tiles will be added if the extent has changed.</bullet_item><para/>
        ///     <bullet_item>Delete Tiles—Tiles will be deleted from the cache. The cache folder structure will not be deleted.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>更新缓存的模式。</para>
        ///   <bulletList>
        ///     <bullet_item>重新创建空切片 - 仅创建空切片。现有磁贴将保持不变。此选项不适用于发布到 ArcGIS Online 的 Web 切片图层。</bullet_item><para/>
        ///     <bullet_item>重新创建所有切片 - 如果范围发生更改，将替换现有切片并添加新切片。</bullet_item><para/>
        ///     <bullet_item>删除切片—切片将从缓存中删除。缓存文件夹结构不会被删除。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public ManageMapServerCacheTiles(object _input_service, List<object> _scales, _update_mode_value _update_mode)
        {
            this._input_service = _input_service;
            this._scales = _scales;
            this._update_mode = _update_mode;
        }
        public override string ToolboxName => "Server Tools";

        public override string ToolName => "Manage Map Server Cache Tiles";

        public override string CallName => "server.ManageMapServerCacheTiles";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_input_service, _scales, _update_mode.GetGPValue(), _num_of_caching_service_instances, _area_of_interest, _update_extent, _wait_for_job_completion.GetGPValue(), _portal_url, _out_job_url];

        /// <summary>
        /// <para>Input Service</para>
        /// <para>The web tile layer or map image layer whose cache tiles you want to update. You can choose it by browsing to the desired service in Portal or you can drag and drop a web tile layer from the Project pane Portal tab to supply this parameter.</para>
        /// <para>要更新其缓存切片的 Web 切片图层或地图图像图层。您可以通过在门户中浏览到所需的服务来选择它，也可以从工程窗格门户选项卡拖放 Web 切片图层以提供此参数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Service")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _input_service { get; set; }


        /// <summary>
        /// <para>Scales</para>
        /// <para><xdoc>
        ///   <para>A list of scale levels at which tiles will be created.</para>
        ///   <para>By default, the scales listed in the tool dialog are between the minimum and maximum cached scales for the service. You cannot change the cache scale range of the service with ArcGIS Pro.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将创建切片的比例级别的列表。</para>
        ///   <para>默认情况下，工具对话框中列出的刻度介于服务的最小和最大缓存刻度之间。您无法使用 ArcGIS Pro 更改服务的缓存比例范围。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Scales")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _scales { get; set; }


        /// <summary>
        /// <para>Update Mode</para>
        /// <para><xdoc>
        ///   <para>The mode for updating the cache.</para>
        ///   <bulletList>
        ///     <bullet_item>Recreate Empty Tiles—Only tiles that are empty will be created. Existing tiles will be left unchanged. This option is not available for web tile layers published to ArcGIS Online.</bullet_item><para/>
        ///     <bullet_item>Recreate All Tiles—Existing tiles will be replaced and new tiles will be added if the extent has changed.</bullet_item><para/>
        ///     <bullet_item>Delete Tiles—Tiles will be deleted from the cache. The cache folder structure will not be deleted.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>更新缓存的模式。</para>
        ///   <bulletList>
        ///     <bullet_item>重新创建空切片 - 仅创建空切片。现有磁贴将保持不变。此选项不适用于发布到 ArcGIS Online 的 Web 切片图层。</bullet_item><para/>
        ///     <bullet_item>重新创建所有切片 - 如果范围发生更改，将替换现有切片并添加新切片。</bullet_item><para/>
        ///     <bullet_item>删除切片—切片将从缓存中删除。缓存文件夹结构不会被删除。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Update Mode")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _update_mode_value _update_mode { get; set; }

        public enum _update_mode_value
        {
            /// <summary>
            /// <para>Recreate Empty Tiles</para>
            /// <para>Recreate Empty Tiles—Only tiles that are empty will be created. Existing tiles will be left unchanged. This option is not available for web tile layers published to ArcGIS Online.</para>
            /// <para>重新创建空切片 - 仅创建空切片。现有磁贴将保持不变。此选项不适用于发布到 ArcGIS Online 的 Web 切片图层。</para>
            /// </summary>
            [Description("Recreate Empty Tiles")]
            [GPEnumValue("RECREATE_EMPTY_TILES")]
            _RECREATE_EMPTY_TILES,

            /// <summary>
            /// <para>Recreate All Tiles</para>
            /// <para>Recreate All Tiles—Existing tiles will be replaced and new tiles will be added if the extent has changed.</para>
            /// <para>重新创建所有切片 - 如果范围发生更改，将替换现有切片并添加新切片。</para>
            /// </summary>
            [Description("Recreate All Tiles")]
            [GPEnumValue("RECREATE_ALL_TILES")]
            _RECREATE_ALL_TILES,

            /// <summary>
            /// <para>Delete Tiles</para>
            /// <para>Delete Tiles—Tiles will be deleted from the cache. The cache folder structure will not be deleted.</para>
            /// <para>删除切片—切片将从缓存中删除。缓存文件夹结构不会被删除。</para>
            /// </summary>
            [Description("Delete Tiles")]
            [GPEnumValue("DELETE_TILES")]
            _DELETE_TILES,

        }

        /// <summary>
        /// <para>Number of caching service instances</para>
        /// <para>Defines the number of instances that will be used to update/generate the tiles. The value for this parameter is set to unlimited (-1) and cannot be modified.</para>
        /// <para>定义将用于更新/生成切片的实例数。此参数的值设置为无限制 （-1），无法修改。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of caching service instances")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _num_of_caching_service_instances { get; set; } = null;


        /// <summary>
        /// <para>Area Of Interest</para>
        /// <para><xdoc>
        ///   <para>Defines an area of interest to constrain where tiles will be created or deleted. This parameter is useful if you want to manage tiles for irregularly shaped areas. It's also useful in situations where you want to pre-cache some areas and leave less-visited areas uncached.</para>
        ///   <para>If you do not provide a value for this parameter, the default is to use the full extent of the map.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义感兴趣区域以限制切片的创建或删除位置。如果要管理形状不规则区域的图块，则此参数非常有用。在您想要预缓存某些区域并保留未缓存访问较少的区域的情况下，它也很有用。</para>
        ///   <para>如果未为此参数提供值，则默认为使用地图的全图范围。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Area Of Interest")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _area_of_interest { get; set; } = null;


        /// <summary>
        /// <para>Update Extent</para>
        /// <para><xdoc>
        ///   <para>Rectangular extent at which to create or delete tiles, depending on the value of the Update Mode parameter. It is not recommended you provide values for both Update Extent and Area of Interest. If values for both parameters are provided, the value of Area of Interest will be used.</para>
        ///   <bulletList>
        ///     <bullet_item>Default—The extent will be based on the maximum extent of all participating inputs. This is the default.</bullet_item><para/>
        ///     <bullet_item>Current Display Extent—The extent is equal to the data frame or visible display. The option is not available when there is no active map.</bullet_item><para/>
        ///     <bullet_item>As Specified Below—The extent will be based on the minimum and maximum extent values specified.</bullet_item><para/>
        ///     <bullet_item>Browse—The extent will be based on an existing dataset.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于创建或删除切片的矩形范围，具体取决于“更新模式”参数的值。不建议同时提供“更新范围”和“感兴趣区域”的值。如果同时提供了两个参数的值，则将使用“感兴趣区域”的值。</para>
        ///   <bulletList>
        ///     <bullet_item>默认值 - 范围将基于所有参与输入的最大范围。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>当前显示范围 - 范围等于数据框或可见显示。当没有活动地图时，该选项不可用。</bullet_item><para/>
        ///     <bullet_item>如下所述 - 范围将基于指定的最小和最大范围值。</bullet_item><para/>
        ///     <bullet_item>浏览 - 范围将基于现有数据集。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Update Extent")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _update_extent { get; set; } = null;


        /// <summary>
        /// <para>Wait for job completion</para>
        /// <para><xdoc>
        ///   <para>This parameter allows you to watch the progress of the cache job running on ArcGIS Online or Portal for ArcGIS.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—This tool will continue to run in Pro while the cache job runs on your Portal for ArcGIS or ArcGIS Online. With this option, you can request detailed progress reports at any time and view the geoprocessing messages as they appear.</bullet_item><para/>
        ///     <bullet_item>Unchecked—This tool will submit the job to the Portal, allowing you to perform other geoprocessing tasks in ArcGIS Pro or even close it. This option is used when you choose to build a cache automatically at the time you publish the service, and you can also set this option on any other cache that you build.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>此参数可用于监视在 ArcGIS Online 或 Portal for ArcGIS 上运行的缓存作业的进度。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 当缓存作业在 Portal for ArcGIS 或 ArcGIS Online 上运行时，此工具将继续在 Pro 中运行。使用此选项，您可以随时请求详细的进度报告，并在地理处理消息显示时查看它们。</bullet_item><para/>
        ///     <bullet_item>未选中 - 此工具会将作业提交到门户，从而允许您在 ArcGIS Pro 中执行其他地理处理任务，甚至将其关闭。当您选择在发布服务时自动生成缓存时，将使用此选项，并且还可以在生成的任何其他缓存上设置此选项。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Wait for job completion")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _wait_for_job_completion_value _wait_for_job_completion { get; set; } = _wait_for_job_completion_value._true;

        public enum _wait_for_job_completion_value
        {
            /// <summary>
            /// <para>WAIT</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("WAIT")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>DO_NOT_WAIT</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DO_NOT_WAIT")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Portal URL</para>
        /// <para>The portal URL.</para>
        /// <para>门户 URL。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Portal URL")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _portal_url { get; set; } = null;


        /// <summary>
        /// <para>Output Map Service URL</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Map Service URL")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_job_url { get; set; }


        public ManageMapServerCacheTiles SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}